FamilyParameter Set Value

FamilyParameter Set Value

Anonymous
Not applicable
492 Views
2 Replies
Message 1 of 3

FamilyParameter Set Value

Anonymous
Not applicable

While trying to set the value of a FamilyParameter in Revit, I get this error

 

"Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

 

The code is as follows (and yes, it is inside a BeginTransaction) ...

 

For Each rvtFamilyParameter As Autodesk.Revit.DB.FamilyParameter In rvtFamilyManager.Parameters

                                   

If rvtFamilyParameter.Definition.Name = strName Then

rvtFamilyManager.Set(rvtFamilyParameter, strValue) ' Error occurs right here.

Exit For

End If

                               

Next

 

 

Any ideas?  Is it really bad memory?

 

Thanks,

 

Randy

0 Likes
493 Views
2 Replies
Replies (2)
Message 2 of 3

ollikat
Collaborator
Collaborator

Seems that you are using Visual Basic(?). I don't have much knowledge about it. But just couple of things:

 

- What is rvtFamilyManager object. Is the class defined by you or API? If it's made by you there might be some problems inside the parameter setting function

 

- How about "strValue"? Where does it "point" to? Maybe the object it is refereng has gone out of it's scope?

0 Likes
Message 3 of 3

Anonymous
Not applicable

As it turns out... I wasn't doing anything wrong.  The error was being generated by a few family files.  About 90% of them worked just fine.  If anyone knows why this error is generated by certain family files, I would like to know that.

 

Thanks,

 

Randy

0 Likes